package day06;

import java.util.Random;

public class 程序题第2题 {
    public static void main(String[] args) {
        System.out.println("十个随机数为:");
        Random rand = new Random();
        int[] arr = new int[10];
        int max= arr[0];
        int min =arr[0];
        for (int i=0;i<arr.length;i++){
            arr[i] =rand.nextInt(10) ;
            System.out.println(arr[i]);
            if (arr[i]>max){
                max=arr[i];
            }
            if (arr[i]<min){
                min = arr[i];
            }
        }
        System.out.println("最大值为:"+max);
        System.out.println("最小值为:"+min);
    }
}
